﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using emp.SqlServerDAL;
using System.Data.SqlClient;

public partial class crm_dealers_ToJump : System.Web.UI.Page
{
    protected void Page_Load(object sender, EventArgs e)
    {

        string ild = Request.Params["ild_uid"].ToString();

        string sql = "select *from [INDIVIDUAL_DEALERS] where [ILD_UID]='" + ild + "'";
        System.Data.DataTable dt1 = getTableInfo(sql);
        if (dt1.Rows.Count>0)
        {
            if (dt1.Rows[0]["ILD_CAC_UID"].ToString() == System.Configuration.ConfigurationSettings.AppSettings["brand_cac_uid"])
            {
                Response.Redirect("PinWeiPreview.aspx?ild_uid=" + Request.Params["ild_uid"].ToString() + "&cur_page=0&traceflag=" + Request.Params["traceflag"].ToString(), true);
            }
            else
            {
                Response.Redirect("ConsultTracePreview.aspx?ild_uid=" + Request.Params["ild_uid"].ToString() + "&cur_page=0&traceflag=" + Request.Params["traceflag"].ToString(), true);
            }

        }










    }


    private DataTable getTableInfo(string sql)
    {
        DataSet data = new DataSet();
        using (SqlDataAdapter sda = new SqlDataAdapter())
        {
            try
            {
                sda.SelectCommand = new SqlCommand();
                sda.SelectCommand.CommandText = sql;
                sda.SelectCommand.Connection = new SqlConnection(SQLHelper.CONN_STRING_NON_DTC);
                sda.Fill(data);
            }
            catch { }
        }
        return data.Tables[0];
    }
}
